<?php 
$companyid=$session->read("companyid");
$user=$session->read('User');
$isflag=$action->checkPermissions($user,$companyid);
?>
<?php echo $javascript->link('jquery.timelinr-0.9.4.js');?>
<script type="text/javascript">
	$(function(){
		$().timelinr({
			orientation: 'horizontal',
			containerDiv: '#timeline',
			datesDiv: '#dates',
			datesSelectedClass: 'selected',
			datesSpeed: 500,
			issuesDiv : '#issues',
			issuesSelectedClass: 'selected',
			issuesSpeed: 200,
			issuesTransparency: 0.2,
			issuesTransparencySpeed: 500,
			prevButton: '#prev',
			nextButton: '#next',
			arrowKeys: 'false',
			startAt: 1,
			autoPlay: 'false',
			autoPlayDirection: 'forward',
			autoPlayPause: 2000
	 	});
	});
</script>
<div class="right_side_operate_area">
	<div class="right_side_title left">
		<h2>
		<?php 
		$companyname=$session->read("companyname");
		echo $html->link($companyname,"/companys/showinfosummary/".$companyid);
		?>
    	</h2>
		<div class="clear"></div>
	</div>
	<?php 
		if($isflag){
    		echo '<div class="right item_add_btn">';
			echo $html->link(__('添加',true), 'edittalent');
			echo '</div>';
		}else{
			echo '<div class="right enableaction">';
			echo "<a>添加</a>";
			echo '</div>';
		}
	?>
    <div class="clear"></div>
    <div class="right_sidt_head_screen">
    	<div class="left">
		    <div class="right_side_head_line">
				<ul>
					<li>
						<div class="left screen_condition"><?php echo $html->link("总数","/companys/talent")?>：</div>
						<div class="left screen_counts"><?php echo $talentcount?>个</div>
						<div class="clear"></div>
					</li>
					<div class="clear"></div>
				</ul>
			</div>
		</div>
		<div class="right display_by_year_btn"><?php echo $html->link('返回',"/companys/talent/",null,null); ?></div>
		<div class="clear"></div>
	</div>
</div>
<div class="right_side_scollbar">
	<div class="detail_info_panel">
        <div class="time_line_panel" id='time_panel'>
        	<div class="time_line_area" id="timeline">
            	<ul id="dates">
            	 	<?php foreach($objyears as $stryear){
            	 		$declare_time=$stryear[0]['declare_time'];
            	 	?>
            	 	<li><a href="#<?php echo $declare_time ?>"><?php echo $declare_time ?></a></li>
            	 	<?php }?>
                </ul>
                <ul id="issues">
                	<?php foreach($objyears as $key=>$stryear){
                		$declare_time=$stryear[0]['declare_time'];
                	?>
                    <li id="<?php echo $declare_time ?>">
                        <div class="issue_details">
                        	<div class="right_sidt_screen_by_year">
                        		<div class="right_side_head_line">
                        			<div class="left per_screen_by_time" style="width:auto">
                        				<div class="left screen_condition">
                        					本年度总数：
                        				</div>
                        				<div class="left screen_counts"><?php echo $stryear[0]["count_declare_time"]?></div>
                        				<div class="clear"></div>
                        			</div>
                        			<?php 
                        			$declaretypecount=$stryear[0]['declaretypecount'];
									foreach($declaretypecount as $declaretype){?>
									<div class="left per_screen_by_time" style="width:auto">
										<div class="left screen_condition"><?php echo $declaretype["name"]?>：</div>
										<div class="left screen_counts"><?php echo $declaretype["count"]?>个</div>
										<div class="clear"></div>
									</div>
									<?php }?>
                        			<div class="clear"></div>
                        		</div>
                        	  	<div class="items_list" id='panel'>
						        	<table>
						            	<tr>
						            		<th>时间</th>
                    						<th>申报类型</th>
						                    <th><?php __("Action")?></th>
						                </tr>
						                 <?php 
						                $talents=$stryear['CompTalent'];
										foreach($talents as $talent){
											$id=$talent["CompTalent"]["id"];
											echo "<tr class='per_list'>";
											$declare_time=date("Y-m-d",strtotime($talent["CompTalent"]["declare_time"]));
											echo "<td>".$html->link($declare_time,"/companys/showtalent/".$id,null,null)."</td>";
											echo "<td>".$talent['type_id']['value']."</td>";
											echo "<td>";
											if($isflag){
												echo $html->link(__("Edit",true),"/companys/edittalent/".$id,null,null);
												echo $html->link(__("Delete",true),"/companys/deltalent/".$id,array("onclick"=>"return doaction(this)"));
											}else{
												echo "<span class='enableaction'>编辑</span>";
												echo "<span class='enableaction'>删除</span>";
											}
											echo "</td>";
											echo "</tr>";
										}?>
						            </table>
						      	</div>
							</div>
                        </div>
                    </li>
                    <?php }?>
                </ul>
                <div id="issue_panel_arrow"></div>
                <div id="grad_left"></div>
				<div id="grad_right"></div>
                <a href="#" id="next">+</a>
                <a href="#" id="prev">-</a>
            </div>
        </div>
    </div>
</div>
<?php echo $this->element('actionconfirm',array("title"=>"删除提示","message"=>"你确定要删除吗？")) ?>